#pragma once 
#include <string>
#include "../Headers/authr.h"
#include "../Headers/types.h"
#include "../NS/nameserver.h"
#include "ar.rpc.h"

namespace TOB {
	class Authorization: public AuthRequired {
	 public:		
    Authorization(Nameserver::IP nsip, std::string username, std::string password);
    ~Authorization();

	  Code::Type UserManagement(bool &result);	
	  Code::Type UserManagementPriv(bool &result); // priv
	  Code::Type Email(bool &result);
	  Code::Type FileSharing(bool &result);
	  Code::Type ToDoList(bool &result);
	  Code::Type Calendar(bool &result);
	  Code::Type DirectoryFieldEdit(bool &result); // priv
	  Code::Type DirectoryRecordEdit(bool &result);
	  Code::Type Time(bool &result);
	  Code::Type WebServer(bool &result); 	

   protected:
    Code::Type getPolicy(Policy::Type policy, bool &out);
    Code::Type getRole(Role::Type role, bool &out);
    static void cutAndPaste(char *dest, std::string &source, uint32 length=32);

    bool connected;

   private:
    CLIENT *clnt;
  };
}
